package com.web.controller;

import com.web.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class EmailController {
    @Autowired
    private EmailService emailService;
    @RequestMapping("/email_show")
    public String show() {
        return "pages/email/sendEmail";
    }
    @RequestMapping("/email_send")
    public String sendEmail(HttpServletRequest request) {
        String to = request.getParameter("to");
        String subject = request.getParameter("subject");
        String content = request.getParameter("content");
        emailService.sendEmail(to,subject,content);
        return "redirect:pages/email/sendEmail.html";//重定向
    }
}
